<?php

abstract class Base {

  /**
   * Returns a human readable formatted object.<br />
   * Note that when $die parameter is set to TRUE, the test can not be executed, so the coverage can not reach the 100% score.
   * @param boolean $capture Set to True to capture the output into a variable.
   * @return array Returns a human readable formatted obejct.
   * @link http://be2.php.net/manual/en/function.var-dump.php
   * @link http://be2.php.net/manual/en/function.print-r.php
   */
  public function dump($capture = false, $die = false, $message = "") {
    if (is_bool($capture)) {
      return $capture === true ? $die === true ? die(print_r($this, $capture)) : print_r($this, $capture)  : $die === true ? die(var_dump($this)) : var_dump($this);
    } else {
      throw new IllegalArgumentException("\$capture parameter must be a boolean.");
    }
  }

  /**
   * Gets the class methods' name.
   * @return array Returns an array of methods' name defined for thcurrent object.<br />
   * In case of an error, it returns NULL.
   * @link http://be2.php.net/manual/en/function.get-class-methods.php
   */
  public function getMethods() {
    return get_class_methods($this);
  }

  /**
   * Retrieves the parent class name for object or class.
   * @return string Returns the name of the parent class of the class of which object is an instance or the name.
   * @link http://be2.php.net/manual/en/function.get-parent-class.php
   */
  public function getParentName() {
    return get_parent_class($this);
  }

  /**
   * Returns the type of the current object.
   * @return string The type of the current object.
   * @link http://be.php.net/manual/en/function.gettype.php
   */
  public function getType() {
    return get_class($this);
  }

  /**
   * Gets the properties of the current object.
   * @return array Returns an associative array of objects accessible non-static properties for the current object in scope.<br />
   * If a property have not been assigned a value, it will be returned with a NULL value.
   * @link http://be2.php.net/manual/en/function.get-object-vars.php
   */
  public function getVariables() {
    return get_object_vars($this);
  }

  /**
   * Checks if the object is of this class or has this class as one of its parents.
   * @param string $classname The class name.
   * @return boolean Returns TRUE if the object is of this class or has this class as one of its parents, FALSE otherwise.
   * @link http://be2.php.net/manual/en/function.is-a.php
   */
  public function isA($classname) {
    return is_a($this, $classname);
  }

}

?>
